package com.xizi;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

public class TestLinkedHashMap {
    public static void main(String[] args) {

        System.out.println("*************************测试LinkedHashMap*************");
        Map<Integer, String> map = new LinkedHashMap<>();
        map.put(6, "戏子1");
        map.put(2, "戏子2");
        map.put(3, "戏子3");
        map.put(1, null);

        Set<Integer> keySet = map.keySet();
        for (Integer key : keySet) {
            System.out.println(key + " " + map.get(key));
        }
        System.out.println("*************************测试HashMap*************");
        Map<Integer, String> map1 = new HashMap<>();
        map1.put(6, "戏子1");
        map1.put(2, "戏子2");
        map1.put(3, "戏子3");
        map1.put(1, null);
        Set<Integer> keySet1 = map1.keySet();
        for (Integer key : keySet1) {
            System.out.println(key + " " + map1.get(key));
        }
        System.out.println(map.get(1));
        System.out.println(map1.get(1));
    }
}
